<link rel="stylesheet" href="<?php echo URL::base() ?>media/vendor/css/style.css" type="text/css" media="all" />
<script src="<?php echo URL::base() ?>media/js/jquery-1.10.1.min.js"></script>
<link rel="stylesheet" href="<?php echo URL::base() ?>media/vendor/artdialog/skins/default.css" type="text/css" media="all" />
<script src="<?php echo URL::base() ?>media/vendor/artdialog/jquery.artDialog.js"></script>
<link href="<?php echo URL::base() ?>media/vendor/css/ui-lightness/jquery-ui-1.10.4.custom.css" rel="stylesheet">
<script src="<?php echo URL::base() ?>media/vendor/js/jquery-1.10.2.js"></script>
<script src="<?php echo URL::base() ?>media/vendor/js/jquery-ui-1.10.4.custom.js"></script>
<script src="<?php echo URL::base() ?>media/vendor/js/jquery.ui.datepicker-zh-TW.js"></script>
<script type="text/javascript">
    $(document).ready(function(){
        var payways_id = <?php echo $detail_data['payways_id']?>;
        $("#payways_id option").each(function(){
            if($(this).val() == payways_id)
            {
                  $(this).attr("selected","selected");
            }
        });

        $("input[name$='USD']").keyup(function(){
            checkChinese(this);
        }).blur(function(){
            checkChinese(this);
        });

    });
    function clearDou(obj) {
        obj.value = obj.value.replace(/[，]/g, "");  //清除“数字”和“.”以外的字符
    }

    function checkChinese(obj){
        var val = $(obj).val();
        if(val){
            var coin = $('#coinid').val();
            if(coin>1){
                for(var i = 0; i < val.length; i ++) {
                    if(val.charCodeAt(i) > 127){
                        alert("输入信息包含中文字符 \'" + val[i] + "\' 请仔细审核下");
                        return false;
                    }
                }
                return true;
            }
        }
    }
</script>

<div class="form-horizontal">

    <?php if(isset($detail_data) and $detail_data)
    {
        ?>

    <form action="<?php echo url::base(true)?>supplier/supplierbank/doedit" method="post" id="supplierbank_add_form">

        <div style="display: none">
<input type="hidden" name="id"
       value="<?php echo isset($detail_data['id'])?$detail_data['id']:0?>">
<input type="hidden" name="payaccountinfo_id"
       value="<?php echo isset($detail_data['payaccountinfo_id'])?$detail_data['payaccountinfo_id']:0?>">
<input type="hidden" name="supplier_id" id="supplier_id"
       value="<?php echo isset($detail_data['supplier_id'])?$detail_data['supplier_id']:0?>">
<input type="hidden" name="coinid" id="coinid"
        value="<?php echo isset($detail_data['coinid'])?$detail_data['coinid']:0?>">

        </div>
    <div class="control-group">

            <label class="control-label" >供应商ID：</label>
            <div class="controls">

                <span><?php echo isset($detail_data['supplier_id'])?$detail_data['supplier_id']:''?></span>
            </div>
        </div>

        <div class="control-group">
            <label class="control-label" >供应商名称：</label>
            <div class="controls">
                <span><?php echo isset($detail_data['supplier_name'])?$detail_data['supplier_name']:''?></span>
            </div>
        </div>

        <div class="control-group">
            <label class="control-label">付款类型：</label>
            <div class="controls">
                <?php if(isset($payways_all))
                {?>
                 <select name="payways_id" id="payways_id">
                <?php foreach($payways_all as $payway){?>
                <option value="<?php echo isset($payway['id'])?$payway['id']:0 ?>">
                    <?php echo isset($payway['paywayname'])?$payway['paywayname']:''?>
                </option>
                <?php }?>
                </select>
                <?php
                }?>
            </div>
        </div>

        <?php if($detail_data['coinid']==1){?>
        <div class="control-group">
            <label class="control-label">开户银行：</label>

            <div class="controls">
                <span>
                <input type="text" name="bankname" id="bankname" class="input-large"
                value="<?php echo isset($detail_data['bankname'])?$detail_data['bankname']:''?>" required="required">
                </span>
            </div>
        </div>

        <div class="control-group">
            <label class="control-label">帐号：</label>

            <div class="controls">
                <input type="text" name="bankaccount" id="bankaccount"
                value="<?php echo isset($detail_data['bankaccount'])?$detail_data['bankaccount']:''?>" required="required">
            </div>
        </div>

        <div class="control-group">
            <label class="control-label">帐户名：</label>

            <div class="controls">
                <input type="text" name="bankaccountname" id="bankaccountname"
                value="<?php echo isset($detail_data['bankaccountname'])?$detail_data['bankaccountname']:''?>" required="required">
            </div>
        </div>
<?php }else{?>

            <div class="control-group">
                <label class="control-label">收款银行名称：</label>

                <div class="controls">
                    <input type="text" name="bankname" id="bankname"
                           value="<?php echo isset($detail_data['bankname'])?$detail_data['bankname']:''?>" required="required" onkeyup="checkChinese(this)">
                </div>
            </div>

            <div class="control-group">
                <label class="control-label">受款银行地址：</label>

                <div class="controls">
                    <input type="text" name="bankaddress" id="bankaddress"
                           value="<?php echo isset($detail_data['bankaddress'])?$detail_data['bankaddress']:''?>" required="required" onkeyup="checkChinese(this)">
                </div>
            </div>

            <div class="control-group">
                <label class="control-label">受款银行地区(国家、省、市)：</label>

                <div class="controls">
                    <input type="text" name="banklocation" id="banklocation"
                           value="<?php echo isset($detail_data['banklocation'])?$detail_data['banklocation']:''?>" required="required" onkeyup="checkChinese(this)">
                </div>
            </div>

            <div class="control-group">
                <label class="control-label">收款人账户号码/IBAN：</label>

                <div class="controls">
                    <input type="text" name="bankaccount" id="bankaccount"
                           value="<?php echo isset($detail_data['bankaccount'])?$detail_data['bankaccount']:''?>" required="required" onkeyup="checkChinese(this)">
                </div>
            </div>
            <div class="control-group">
                <label class="control-label">收款人名称：</label>

                <div class="controls">
                    <input type="text" name="bankaccountname" id="bankaccountname"
                           value="<?php echo isset($detail_data['bankaccountname'])?$detail_data['bankaccountname']:''?>" required="required" onkeyup="checkChinese(this)">
                </div>
            </div>

            <div class="control-group">
                <label class="control-label">收款人地址：</label>

                <div class="controls">
                    <input type="text" name="bankmanaddress" id="bankmanaddress"
                           value="<?php echo isset($detail_data['bankmanaddress'])?$detail_data['bankmanaddress']:''?>" required="required" onkeyup="checkChinese(this)">
                </div>
            </div>

            <div class="control-group">
                <label class="control-label">银行代码SWIFT：</label>

                <div class="controls">
                    <input type="text" name="bankswift" id="bankswift"
                           value="<?php echo isset($detail_data['bankswift'])?$detail_data['bankswift']:''?>" required="required" onkeyup="checkChinese(this)">
                </div>
            </div>

        <?php }?>
        <div class="controls">

            <input type="button" value="返回" class="btn btn-info"
                   onclick="javascipt:history.back()" />
            <input type="submit" value="提交" class="btn btn-info" name="edit_submit">
        </div>
        </form>
    <?php }?>
</div>